package top.kaoshanji.p1ch05a;

import top.kaoshanji.y1onjava.Range;

/**
 * 代码清单-p1ch05a-090页a：break和continue关键字
 * author kaoshanji
 * ^_^
 * create time 2025/3/6 21:52
 */
public class BreakAndContinue {

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            if (i == 74) break; // 跳出 for 循环
            if (i % 9 != 0) continue; // 下次迭代
            System.out.println(i + " ");
        }
        System.out.println();

        // 使用 for-in
        for (int i: Range.range(100)) {
            if (i == 74) break;
            if (i % 9 != 0) continue;
            System.out.println(i + " ");
        }

        System.out.println();
        int i = 0;
        // 一个“无限循环”
        while (true) {
            i++;
            int j = i * 27;
            if (j == 12269) break;
            if (i % 10 != 0) continue;
            System.out.println(i + " ");
        }

    }
}
